package jmine.tec.test.metric.performance;

import static jmine.tec.test.metric.performance.ResultSuccessBuilder.umSuccess;
import jmine.tec.test.Builder;

/**
 * @author bruno.ortiz
 */
public class ResultBuilder implements Builder<Result> {

    private Builder<ResultSuccess> success = umSuccess();

    private Builder<Performance> performance;

    /**
     * @return ResultBuilder
     */
    public static ResultBuilder umResult() {
        return new ResultBuilder();
    }

    /**
     * @param value value
     * @return this
     */
    public ResultBuilder comSuccess(Builder<ResultSuccess> value) {
        this.success = value;
        return this;
    }

    /**
     * @param value value
     * @return this
     */
    public ResultBuilder paraUmaPerformance(Builder<Performance> value) {
        this.performance = value;
        return this;
    }

    /**
     * @return result
     */
    public Result build() {
        if (this.performance == null) {
            return new Result(this.success.build());
        } else {
            return new Result(this.success.build(), this.performance.build());
        }
    }

}
